<template>
  <div class="remark-box">
    <el-form label-width="0">
      <el-form-item :rules="rules">
        <el-input type="textarea"
                  show-word-limit
                  :placeholder="placeholder"
                  :maxlength="maxlength"
                  :value="value"
                  @input="handleInput" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "RemarkForm",
  props: {
    value: String,
    rules: {
      type: Array,
      default () {
        return [{
          required: true, message: "备注不能为空", trigger: 'blur'
        }]
      }
    },
    maxlength: {
      type: Number,
      default () {
        return 200
      }
    },
    placeholder: {
      type: String,
      default () {
        return "请输入备注"
      }
    }
  },
  data () {
    return {};
  },
  computed: {
  },
  methods: {
    handleInput (value) {
      this.$emit("input", value.trim())
    }
  }
};
</script>

<style>
.remark-box {
  max-height: 400px;
}
</style>
